<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
</head>

<body>
    <div id="app">
        <message></message>
    </div>
    <script>
        var myMixin = {
            created() {
                this.sayHello()
            },
            methods: {
                sayHello() {
                    console.log("我是混入的")
                }
            },
        }
        Vue.component("message", {
            mixins: [myMixin],
            template: `
                <div>恭喜</div>
            `
        })
        var vm = new Vue({
            el: "#app",
            data: {
                msg: "hello vue ",
            },
        })
    </script>
</body>

</html>